<?php

namespace app\api\validate;

use think\Validate;

class Worker extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'name' => 'require|chsDash',
        'type_id' => 'require|number',
        'mobile' => 'require',
        'year' => 'require',
        'address' => 'require|chsDash',
        'avatar' => 'require|url',
        'images' => 'require|url',
        'area_id' => 'require|number',

        'worker_user_id' => 'require|number',
        'day' => 'require|chsDash',
        'time' => 'require',
        'server_content' => 'require|chsDash',

        'content' => 'require|chsDash',
        'star' => 'require|chsDash',
        'order_id' => 'require|number',

        'money' => 'require|float',
    ];
    /**
     * 提示消息
     */
    protected $message = [
        'area_id.number' => '服务地区参数格式错误',
        'area_id.require' => '服务地区必传',
        'content.require' => '评价内容必传',
        'content.chsDash' => '评价内容格式不正确',
        'star.require' => '评分必传',
        'star.chsDash' => '评分格式不正确',
        'order_id.require' => '订单号必传',
        'order_id.chsDash' => '订单号格式不正确',
        'worker_user_id.require' => '工匠用户ID必传',
        'worker_user_id.chsDash' => '工匠用户ID格式不正确',
        'day.require' => '请输入上门日期',
        'day.chsDash' => '上门日期格式不正确',
        'time.require' => '请输入上门时间',
        'time.chsDash' => '上门时间格式不正确',
        'server_content.require' => '请输入服务内容',
        'server_content.chsDash' => '服务内容格式不正确',
        'avatar.url' => '头像格式错误',
        'avatar.require' => '请上传头像',
        'images.url' => '工匠秀格式错误',
        'images.require' => '请上传工匠秀',
        'mobile.require' => '请输入手机号码',
        'mobile.mobile' => '手机号码格式不正确',
        'address.require' => '请输入地址',
        'address.chsDash' => '地址格式不正确',
        'name.require' => '请输入姓名',
        'name.chsDash' => '姓名格式不正确',
        'type_id.require' => '请选择类型',
        'type_id.chsDash' => '类型格式不正确',
        'year.require' => '请输入工作年限',
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['name','type_id','mobile','year','address','area_id'],
        'add_images'  => ['images'],
        'add_order' => ['worker_user_id','day','time','server_content','mobile','address'],
        'add_ping' => ['content','star','order_id'],
        'pay' => ['money'],
    ];
    
}
